package com.xtayfjpk.security;

import java.io.FileInputStream;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;

import org.apache.commons.codec.binary.Base64;

public class PemTest {

	public static void main(String[] args) throws Exception {
		CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
		FileInputStream inStream = new FileInputStream("H:/ca.cer");
		Certificate certificate = certificateFactory.generateCertificate(inStream);
		System.out.println(certificate);
		String result = Base64.encodeBase64String(certificate.getEncoded());
		System.out.println(result);
	}

}
